package com.wicket.okrapp.biz.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrapp.biz.service.dto.req.*;
import com.wicket.okrapp.biz.service.dto.res.*;
import com.wicket.okrapp.common.util.RedisUtil;

import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wicket.okrapp.biz.service.nb.NbDataSetSingleEntry;
import com.wicket.okrcomponent.integration.FwCompInterfaceModeClient;
import com.wicket.okrapp.base.service.MOmsTspeCycleStageDataService;
import com.wicket.okrapp.biz.service.dto.common.PicMultipleSetDataEntryDto;
import com.wicket.okrcomponent.integration.FwCompDataSetSingleEntryClient;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class DataSetSingleEntryServiceImpl
  implements com.wicket.okrapp.biz.service.DataSetSingleEntryService {

  @Resource
  private RedisUtil redisUtil;
//@Resource
 //private MCustomFieldsService mCustomFieldsService;
@Resource
  private NbDataSetSingleEntry nbDataSetSingleEntry;
@Resource
  private FwCompInterfaceModeClient fwCompInterfaceModeClient;
@Resource
  private MOmsTspeCycleStageDataService mOmsTspeCycleStageDataService;
@Resource
  private FwCompDataSetSingleEntryClient fwCompDataSetSingleEntryClient;

/**
   * D3执行图片多条转数据集(公共)[8079]
   * gen by moon at 12/5/2023, 12:41:19 AM
   */
  @Trace(operationName = "D3执行图片多条转数据集(公共)")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public ImplementPicMultipleSetDataEntryComRespDto implementPicMultipleSetDataEntryCom(ImplementPicMultipleSetDataEntryComReqDto reqDto){


      ImplementPicMultipleSetDataEntryRespDto objectToDataRes_1 =null;
//步骤0: M3执行图片多条转数据集 - implementPicMultipleSetDataEntry
     //ModelCode: objectToData
        ImplementPicMultipleSetDataEntryRespDto objectToDataRes = null;
    ImplementPicMultipleSetDataEntryReqDto objectToDataReq=new ImplementPicMultipleSetDataEntryReqDto();
  if(reqDto!=null){
      objectToDataReq.setPicMultipleSetDataEntryList(reqDto.getPicMultipleSetDataEntryList().stream().map(item -> BeanUtil.toBean(item, PicMultipleSetDataEntryDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1379330_1
    }

    /*M3执行图片多条转数据集[2801]  用于周期阶段资料内容中查询的多个图片信息，数据库中一个字段中的信息将转换到多张图片信息的地址（数据集）供前端展示 */

      objectToDataRes = nbDataSetSingleEntry.implementPicMultipleSetDataEntry(objectToDataReq);


      objectToDataRes_1 = objectToDataRes;

ImplementPicMultipleSetDataEntryComRespDto retData = new ImplementPicMultipleSetDataEntryComRespDto();
  if(objectToDataRes_1!=null){
      retData.setPicMultipleSetDataEntryList(objectToDataRes_1.getPicMultipleSetDataEntryList().stream().map(item -> BeanUtil.toBean(item, PicMultipleSetDataEntryDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1379333_1
    }




return retData;
  }
  //
}
